package cn.edu.dzkd.software.advice;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

@RestControllerAdvice
public class MyExceptionHandlerAdvice {

    @ExceptionHandler(Throwable.class)
    public Map<String, Object> exceptionCheck(Throwable t) {
        Map<String, Object> map = new HashMap<>();
        map.put("code", "999");
        map.put("msg", "异常拦截");
        map.put("exception", t);
        // 加入日志保存管理处理
        return map;
    }
}
